<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<!--================================================================================
  Item Name: Materialize - Material Design Admin Template
  Version: 4.0
  Author: PIXINVENT
  Author URL: https://themeforest.net/user/pixinvent/portfolio
================================================================================ -->

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="msapplication-tap-highlight" content="no">
    <!--<meta name="description"-->
          <!--content="Materialize is a Material Design Admin Template,It's modern, responsive and based on Material Design by Google. ">-->
    <!--<meta name="keywords"-->
          <!--content="materialize, admin template, dashboard template, flat admin template, responsive admin template,">-->
    <title>BAUHINIA SQUARE Admin</title>
    <!-- Favicons-->
    <link rel="icon" href="images/favicon/favicon-32x32.png" sizes="32x32">
    <!-- Favicons-->
    <link rel="apple-touch-icon-precomposed" href="images/favicon/apple-touch-icon-152x152.png">
    <!-- For iPhone -->
    <meta name="msapplication-TileColor" content="#00bcd4">
    <meta name="msapplication-TileImage" content="images/favicon/mstile-144x144.png">
    <!-- For Windows Phone -->
    <!-- CORE CSS-->
    <link href="css//materialize.css" type="text/css" rel="stylesheet">
    <link href="css//style.css" type="text/css" rel="stylesheet">
    <!-- Custome CSS-->
    <link href="css/custom/custom.css" type="text/css" rel="stylesheet">
    <!-- INCLUDED PLUGIN CSS ON THIS PAGE -->
    <link href="vendors/perfect-scrollbar/perfect-scrollbar.css" type="text/css" rel="stylesheet">
    <link href="vendors/flag-icon/css/flag-icon.min.css" type="text/css" rel="stylesheet">

    <link href="dropify/dist/css/dropify.min.css" type="text/css" rel="stylesheet" media="screen,projection">
    <link href="css/parsley.css" type="text/css" rel="stylesheet" media="screen,projection">

    <style>
        html,
        body,
        #container {
            width: 100%;
            height: 100%;
            margin: 0px;
            font-size: 13px;
        }

        #pickerBox {
            position: absolute;
            z-index: 9999;
            top: 50px;
            right: 30px;
            width: 300px;
        }

        #pickerInput {
            width: 200px;
            padding: 5px 5px;
        }

        #poiInfo {
            background: #fff;
        }

        .amap_lib_placeSearch .poibox.highlight {
            background-color: #CAE1FF;
        }

        .amap_lib_placeSearch .poi-more {
            display: none !important;
        }
    </style>
</head>

<body class="active-activity">
<!-- Start Page Loading -->
<div id="loader-wrapper">
    <div id="loader"></div>
    <div class="loader-section section-left"></div>
    <div class="loader-section section-right"></div>
</div>
<!-- End Page Loading -->
<!-- //////////////////////////////////////////////////////////////////////////// -->
<!-- START HEADER -->
<header id="header" class="page-topbar">
    <!-- start header nav-->
    <div class="navbar-fixed" th:include="header :: header"></div>
    <!-- end header nav-->
</header>
<!-- END HEADER -->
<!-- //////////////////////////////////////////////////////////////////////////// -->
<!-- START MAIN -->
<div id="main">
    <!-- START WRAPPER -->
    <div class="wrapper">
        <!-- START LEFT SIDEBAR NAV-->
        <aside id="left-sidebar-nav" th:include="leftNavigation :: navigation">
        </aside>
        <!-- END LEFT SIDEBAR NAV-->
        <!-- //////////////////////////////////////////////////////////////////////////// -->
        <!-- START CONTENT -->
        <div id="content">
            <!--breadcrumbs start-->
            <div id="breadcrumbs-wrapper">
                <div class="container">
                    <div class="row">
                        <div class="col s10 m6 l6">
                            <h5 class="breadcrumbs-title">活动基本信息</h5>
                            <ol class="breadcrumbs">
                                <li><a href="/">上海紫荆广场</a>
                                </li>
                                <li><a href="#">活动</a>
                                </li>
                                <li class="active">活动基本信息 录入</li>
                            </ol>
                        </div>
                    </div>
                </div>
            </div>
            <!--breadcrumbs end-->
            <!--start container-->
            <div class="container">
                <div class="section">
                    <!--<p class="caption">在下列表单中填写商场基本信息 上传商场轮播图片</p>-->
                    <!--<div class="divider"></div>-->
                </div>

                <!-- ////////////////////////////////////// form start ////////////////////////////////////// -->
                <form method="POST" enctype="multipart/form-data" action="/editActivity" data-parsley-validate>
                    <div class="row">
                        <div class="col s0 m0 l2"></div>
                        <div class="col s12 m12 l8">
                            <div class="card-panel" style="margin-top:1.2em;">
                                <h4 class="header2">活动基础信息</h4>
                                <div class="row">
                                    <div class="col s12">
                                        <div class="row">
                                            <div class="input-field col s12">
                                                <i class="material-icons prefix">card_giftcard</i>
                                                <input type="text" id="title" name="title" class="validate"
                                                       th:value="${activity?.title}" equired data-parsley-required
                                                       data-parsley-required-message="不能为空">
                                                <label for="title">活动主题</label>
                                            </div>
                                        </div>
                                        <div class="row" style="margin-bottom:1.2em;">
                                            <div class="input-field col s12">
                                                <input type="file" id="input-file-now1" name="file"
                                                       data-show-remove="false"
                                                       class="dropify dropify-event"
                                                       data-default-file=""
                                                       data-allowed-file-extensions="png jpg jpeg"/>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="input-field col s5">
                                                <i class="material-icons prefix">today</i>
                                                <input type="text" class="validate"
                                                       id="activityTimeStart1" name="activityTimeStart1"
                                                       placeholder="2017-11-13 17:00:00"
                                                       equired data-parsley-required
                                                       data-parsley-required-message="不能为空"
                                                       pattern="([0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1]) (2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9])"
                                                       data-parsley-pattern="([0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1]) (2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9])"
                                                       data-parsley-pattern-message="字段内容不是正确的时间格式">
                                                <label for="activityTimeStart1">活动时间</label>
                                            </div>
                                            <div class="input-field col s1">
                                                <span style="margin-top:1.2em;width:100%;text-align:center;display:inline-block;">至</span>
                                            </div>
                                            <div class="input-field col s5">
                                                <input type="text" class="validate"
                                                       id="activityTimeEnd1" name="activityTimeEnd1"
                                                       placeholder="2017-11-13 22:00:00"
                                                       equired data-parsley-required
                                                       data-parsley-required-message="不能为空"
                                                       pattern="([0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1]) (2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9])"
                                                       data-parsley-pattern="([0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1]) (2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9])"
                                                       data-parsley-pattern-message="字段内容不是正确的时间格式">
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="input-field col s12">
                                                <i class="material-icons prefix">location_on</i>
                                                <input type="text" id="address" name="address"
                                                       class="validate"
                                                       th:value="${activity?.address}" equired data-parsley-required
                                                       data-parsley-required-message="不能为空">
                                                <label for="address">活动地址</label>
                                            </div>
                                        </div>

                                        <div class="row">

                                            <div class="col s12">
                                                <ul class="collapsible collapsible-accordion"
                                                    data-collapsible="accordion">
                                                    <li>
                                                        <div class="collapsible-header">
                                                            <i class="material-icons">blur_circular</i> 是否需要报名
                                                        </div>
                                                        <div class="collapsible-body">
                                                            <div class="row">
                                                                <div class="input-field col s12">
                                                                    <i class="material-icons prefix">date_range</i>
                                                                    <input type="text" class="validate"
                                                                           id="signUpEnd1" name="signUpEnd1"
                                                                           placeholder="1980-01-01"
                                                                           pattern="(([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])))"
                                                                           data-parsley-pattern="(([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])))"
                                                                           data-parsley-pattern-message="字段内容不是正确的日期格式">
                                                                    <label for="signUpEnd1">报名截止日期</label>
                                                                </div>
                                                            </div>
                                                            <div class="row">
                                                                <div class="input-field col s12">
                                                                    <i class="material-icons prefix">phonelink_erase</i>
                                                                    <input type="number" min="0" id="signUpLimited"
                                                                           name="signUpLimited"
                                                                           class="validate"
                                                                           th:value="${activity?.sign_up_limited}"
                                                                           data-parsley-type="integer"
                                                                           data-parsley-type-message="必须是整数"
                                                                           data-parsley-max="99999999" data-parsley-max-message="数值超出最大范围">
                                                                    <label for="signUpLimited">报名限制人数</label>
                                                                </div>
                                                            </div>
                                                            <div class="row">
                                                                <div class="input-field col s12">
                                                                    <i class="material-icons prefix">star_border</i>
                                                                    <input type="number" min="0" id="signUpPoints" name="signUpPoints"
                                                                           class="validate"
                                                                           th:value="${activity?.sign_up_points}"
                                                                           data-parsley-type="integer"
                                                                           data-parsley-type-message="必须是整数"
                                                                           data-parsley-max="99999999" data-parsley-max-message="数值超出最大范围">
                                                                    <label for="signUpPoints">报名积分</label>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>

                                        <div class="row" style="margin-top:.3em">
                                            <div class="col s12" style="margin:2em 0;">
                                                <i class="material-icons prefix">speaker_notes</i>
                                                <div style="position:relative;top:-2.4em;left:.7em;display:inline-block">
                                                    <sapn style="display:inline-block;padding:0;color:#9F9F9F">是否评论
                                                    </sapn>
                                                </div>
                                                <div class="switch" style="display:inline-block;margin-left:-3em">
                                                    <label>
                                                        Off
                                                        <input id="isComment1" type="checkbox">
                                                        <span class="lever"></span>
                                                        On
                                                    </label>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="divider" style="margin-bottom:1em"></div>

                                        <div class="row">
                                            <div class="col s12" style="margin:2em 0;">
                                                <i class="material-icons prefix">settings_cell</i>
                                                <div style="position:relative;top:-2.4em;left:.7em;display:inline-block">
                                                    <sapn style="display:inline-block;padding:0;color:#9F9F9F">是否需要签到
                                                    </sapn>
                                                </div>
                                                <div class="switch" style="display:inline-block;margin-left:-5em">
                                                    <label>
                                                        Off
                                                        <input id="isSignIn1" type="checkbox">
                                                        <span class="lever"></span>
                                                        On
                                                    </label>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="divider" style="margin-bottom:1em"></div>

                                        <div class="row">
                                            <div class="input-field col s12">
                                                <i class="material-icons prefix">star</i>
                                                <input type="number" min="0" id="incentivePoints" name="incentivePoints"
                                                       class="validate"
                                                       th:value="${activity?.incentive_points}" equired
                                                       data-parsley-required
                                                       data-parsley-required-message="不能为空"
                                                       data-parsley-type="integer"
                                                       data-parsley-type-message="必须是整数"
                                                       data-parsley-max="99999999" data-parsley-max-message="数值超出最大范围">
                                                <label for="incentivePoints">奖励积分</label>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="input-field col s12">
                                                <!--<textarea name="intro" id="intro" rows="10" cols="80" th:text="${shop?.intro}"-->
                                                <!--class="materialize-textarea" equired data-parsley-required-->
                                                <!--data-parsley-required-message="不能为空">-->
                                                <!--<p style="font-size:8pt">商户简介</p>-->
                                                <!--</textarea>-->
                                                <textarea name="intro" id="intro"
                                                          th:text="${activity?.intro}"
                                                          class="materialize-textarea">
                                                    <p style="font-size:8pt">优惠券简介</p>
                                                </textarea>
                                            </div>
                                            <!--<div class="row">-->
                                            <!--<div class="input-field col s12">-->
                                            <!--<i class="material-icons prefix">dehaze</i>-->
                                            <!--<input type="number" id="sortId" name="sortId" class="validate"-->
                                            <!--th:value="${coupon?.sort_id}" equired data-parsley-required-->
                                            <!--data-parsley-required-message="不能为空" data-parsley-type="integer"-->
                                            <!--data-parsley-type-message="必须是整数">-->
                                            <!--<label for="sortId">排序号</label>-->
                                            <!--</div>-->
                                            <!--</div>-->
                                            <div class="row">
                                                <div class="input-field col s12">
                                                    <button type="submit" style="margin-right:.7em"
                                                            class="waves-effect waves-light btn right"><i
                                                            class="material-icons right">send</i>保&emsp;存
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col s0 m0 l2"></div>

                    <input type="hidden" id="activityId" name="activityId" th:value="${activity?.activity_id}">
                    <input type="hidden" id="introId" name="introId" th:value="${activity?.intro_id}">
                    <input type="hidden" id="activityTimeStart" name="activityTimeStart" th:value="${activity?.activity_time_start}">
                    <input type="hidden" id="activityTimeEnd" name="activityTimeEnd" th:value="${activity?.activity_time_end}">
                    <input type="hidden" id="isSignUp" name="isSignUp" th:value="${isSignUp}">
                    <input type="hidden" id="isSignIn" name="isSignIn" th:value="${isSignIn}">
                    <input type="hidden" id="isComment" name="isComment" th:value="${isComment}">
                    <input type="hidden" id="signUpEnd" name="signUpEnd" th:value="${activity?.sign_up_end}">
                </form>
                <!-- ////////////////////////////////////// form end ////////////////////////////////////// -->
            </div>
        </div>
        <!-- //////////////////////////////////////////////////////////////////////////// -->
    </div>
    <!--end container-->
    </section>
    <!-- END CONTENT -->
    <!-- START RIGHT SIDEBAR NAV-->
    <aside id="right-sidebar-nav" th:include="rightSidebarNav :: right-sidebar-nav">
    </aside>
    <!-- END RIGHT SIDEBAR NAV-->
</div>
<!-- END WRAPPER -->
</div>
<div class="section"></div>
<!-- END MAIN -->
<!-- //////////////////////////////////////////////////////////////////////////// -->
<!-- START FOOTER -->
<footer class="page-footer gradient-45deg-light-cyan-cyan" th:include="footer :: footer">
</footer>

<!-- END FOOTER -->
<!-- ================================================
Scripts
================================================ -->
<!-- jQuery Library -->
<!--<script type="text/javascript" src="vendors/jquery-3.2.1.min.js"></script>-->
<script src="https://code.jquery.com/jquery-2.2.4.min.js"
        integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
<script src="https://cdn.bootcss.com/parsley.js/2.8.0/parsley.min.js"></script>
<!--materialize js-->
<script type="text/javascript" src="js/materialize.min.js"></script>
<!--scrollbar-->
<script type="text/javascript" src="vendors/perfect-scrollbar/perfect-scrollbar.min.js"></script>
<!--plugins.js - Some Specific JS codes for Plugin Settings-->
<script type="text/javascript" src="js/plugins.js"></script>
<!--custom-script.js - Add your own theme custom JS-->
<script type="text/javascript" src="js/custom-script.js"></script>

<script src="dropify/dist/js/dropify.min.js"></script>
<script src="ckeditor/ckeditor.js"></script>

<script th:inline="javascript">

    $(document).ready(function () {

        /********************** init start ******************************************************/
        var picture = [[${activity?.picture}]]
        log(picture)
        if (picture) {
            $("#input-file-now1").attr("data-default-file", picture)
        }

        var activityTimeStart =  [[${activity?.activity_time_start}]]
        if (activityTimeStart) {
            $('#activityTimeStart1').val(dateTimeString(new Date(activityTimeStart)))
        }

        var activityTimeEnd =  [[${activity?.activity_time_end}]]
        if (activityTimeEnd) {
            $('#activityTimeEnd1').val(dateTimeString(new Date(activityTimeEnd)))
        }

        var signUpEnd = [[${activity?.sign_up_end}]]
        if (signUpEnd) {
            $('#signUpEnd1').val(dateString(new Date(signUpEnd)))
        } else {
            $('#signUpEnd').val(dateToMilliseconds(dateString(new Date())))
        }

        var isSignUp = [[${isSignUp}]]
        if (isSignUp) {
            $('.collapsible').collapsible('open', 0);
        } else {
            $('.collapsible').collapsible('close', 0);
            $('#isSignUp').val(false)
        }

        var isSignIn = [[${isSignIn}]]
        if (isSignIn) {
            $('#isSignIn1').prop('checked', true)
        } else {
            $('#isSignIn1').prop('checked', false)
            $('#isSignIn').val(false)
        }

        var isComment = [[${isComment}]]
        if (isComment) {
            $('#isComment1').prop('checked', true)
        } else {
            $('#isComment1').prop('checked', false)
            $('#isComment').val(false)
        }

        /********************** init end ******************************************************/


        /*=============================== dropify start ====================================================================*/

        // Basic
        $('.dropify').dropify({
            messages: {
                'default': '点击或拖拽到这里',
                'replace': '点击或拖拽进行替换',
                'remove': '删除',
                'error': '文件格式错误'
            },
            error: {
                'fileSize': 'The file size is too big ({{ value }} max).',
                'fileExtension': '只能上传 ({{ value }}) 格式的文件.',
                'minWidth': 'The image width is too small ({{ value }}}px min).',
                'maxWidth': 'The image width is too big ({{ value }}}px max).',
                'minHeight': 'The image height is too small ({{ value }}}px min).',
                'maxHeight': 'The image height is too big ({{ value }}px max).',
                'imageFormat': '只能上传 ({{ value }}) 格式的文件.'
            },
            tpl: {
                wrap: '<div class="dropify-wrapper"></div>',
                loader: '<div class="dropify-loader"></div>',
                message: '<div class="dropify-message"><span class="file-icon" /> <p style="text-align:center">{{ default }}</p></div>',
                preview: '<div class="dropify-preview"><span class="dropify-render"></span><div class="dropify-infos"><div class="dropify-infos-inner"><p class="dropify-infos-message">{{ replace }}</p></div></div></div>',
                filename: '<p class="dropify-filename"><span class="dropify-filename-inner"></span></p>',
                clearButton: '<button type="button" class="dropify-clear">{{ remove }}</button>',
                errorLine: '<p class="dropify-error">{{ error }}</p>',
                errorsContainer: '<div class="dropify-errors-container"><ul></ul></div>'
            }
        })

        $('select').material_select()

        $('.collapsible').collapsible({
            accordion: false, // A setting that changes the collapsible behavior to expandable instead of the default accordion style
            onOpen: function (el) {
                log('Open')
                $('#isSignUp').val(parseInt(1))

            }, // Callback for Collapsible open
            onClose: function (el) {
                log('Closed')
                $('#isSignUp').val(parseInt(0))
            } // Callback for Collapsible close
        })

        $('#activityTimeStart1').on('change', function(event) {
            $('#activityTimeStart').val(dateToMilliseconds(event.target.value))
            log($('#activityTimeStart').val())
        })

        $('#activityTimeEnd1').on('change', function(event) {
            $('#activityTimeEnd').val(dateToMilliseconds(event.target.value))
            log($('#activityTimeEnd').val())
        })

        $('#signUpEnd1').on('change', function(event) {
            $('#signUpEnd').val(dateToMilliseconds(event.target.value))
            log($('#signUpEnd').val())
        })

        $('#isSignIn1').on('change', function(event) {
            if (event.target.checked) {
                log('isSignIn1 value true')
                $('#isSignIn').val(parseInt(1))
            } else {
                log('isSignIn1 value false')
                $('#isSignIn').val(parseInt(0))
            }

        })

        $('#isComment1').on('change', function(event) {
            if (event.target.checked) {
                log('isSignIn1 value true')
                $('#isComment').val(parseInt(1))
            } else {
                log('isSignIn1 value false')
                $('#isComment').val(parseInt(0))
            }
        })
    })

    CKEDITOR.replace('intro', {
        height: '20em'
    })
</script>
</body>

</html>